<?php
/**
 * desc Created by wang.
 * User: wang
 * motto: 是时候为小时候吹过的牛而努力了!
 * Date: 2020/3/18 9:37
 */

namespace app\admin\controller;


use think\facade\View;
use app\admin\business\Log as BusLog;
use app\admin\business\Manager as BusManager;

class Log extends AdminBase
{

    /**
     * 功能说明 后台操作日志
     * @author: wang
     * @Date: 2020/4/3 11:18
     * @return string|\think\response\Json
     * @throws \think\db\exception\DataNotFoundException
     * @throws \think\db\exception\DbException
     * @throws \think\db\exception\ModelNotFoundException
     */
    public function index()
    {
        if ($this->request->isAjax()) {
            $limit = $this->request->param('limit', '', 'trim,htmlspecialchars')??15;
            $username = $this->request->param('username', '', 'trim,htmlspecialchars');
            $where = [];
            if (!empty($username) && $username != '') {
                $where[] = ['username', '=', $username];
            }
            $list = BusLog::getLogList($where, $limit);
            return $this->show(config('status.lay_table'), 'success', $list);
        }
        $data = BusManager::getAllManager();
        return View::fetch('index', [
            'data' => $data
        ]);
    }


}